package com.ruoyi.index.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.index.domain.TodoInfo;
import com.ruoyi.index.mapper.TodoInfoMapper;
import com.ruoyi.index.service.ITodoInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 代办Service业务层处理
 *
 * @author ruoyi
 * @date 2022-09-08
 */
@Service
public class TodoInfoServiceImpl implements ITodoInfoService {
    @Autowired
    private TodoInfoMapper todoInfoMapper;

    /**
     * 查询代办
     *
     * @param id 代办主键
     * @return 代办
     */
    @Override
    public TodoInfo selectTodoInfoById(Long id) {
        return todoInfoMapper.selectTodoInfoById(id);
    }

    /**
     * 查询代办列表
     *
     * @param todoInfo 代办
     * @return 代办
     */
    @Override
    public List<TodoInfo> selectTodoInfoList(TodoInfo todoInfo) {
        return todoInfoMapper.selectTodoInfoList(todoInfo);
    }

    /**
     * 新增代办
     *
     * @param todoInfo 代办
     * @return 结果
     */
    @Override
    public int insertTodoInfo(TodoInfo todoInfo) {
        todoInfo.setCreateTime(DateUtils.getNowDate());
        return todoInfoMapper.insertTodoInfo(todoInfo);
    }

    /**
     * 修改代办
     *
     * @param todoInfo 代办
     * @return 结果
     */
    @Override
    public int updateTodoInfo(TodoInfo todoInfo) {
        return todoInfoMapper.updateTodoInfo(todoInfo);
    }

    /**
     * 批量删除代办
     *
     * @param ids 需要删除的代办主键
     * @return 结果
     */
    @Override
    public int deleteTodoInfoByIds(Long[] ids) {
        return todoInfoMapper.deleteTodoInfoByIds(ids);
    }

    /**
     * 删除代办信息
     *
     * @param id 代办主键
     * @return 结果
     */
    @Override
    public int deleteTodoInfoById(Long id) {
        return todoInfoMapper.deleteTodoInfoById(id);
    }
}
